//
//  YQNavigationViewController.swift
//  SinaWeibo
//
//  Created by yang on 15/11/16.
//  Copyright © 2015年 yang. All rights reserved.
//

import UIKit

class YQNavigationViewController: UINavigationController {

    override func viewDidLoad() {
        super.viewDidLoad()
    }

    override func pushViewController(viewController: UIViewController, animated: Bool) {
        if self.childViewControllers.count != 0{
            viewController.navigationItem.backBarButtonItem = UIBarButtonItem (title: "返回", style: .Plain, target: self, action: "back")
            viewController.hidesBottomBarWhenPushed = true
        }
        
        super.pushViewController(viewController, animated: animated)
    }
    @objc func back (){
   navigationController?.popToRootViewControllerAnimated(true)
    }
}
